/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package edu.cmu.cs.webapp.ioms.models.impl;

import edu.cmu.cs.webapp.ioms.models.IOMSPackage;
import edu.cmu.cs.webapp.ioms.models.Ingredient;
import java.util.Date;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc --> An implementation of the model object '
 * <em><b>Ingredient</b></em>'. <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link edu.cmu.cs.webapp.ioms.models.impl.IngredientImpl#getIng_id <em>Ing id</em>}</li>
 *   <li>{@link edu.cmu.cs.webapp.ioms.models.impl.IngredientImpl#getName <em>Name</em>}</li>
 *   <li>{@link edu.cmu.cs.webapp.ioms.models.impl.IngredientImpl#getInventory <em>Inventory</em>}</li>
 *   <li>{@link edu.cmu.cs.webapp.ioms.models.impl.IngredientImpl#getUnit_cost <em>Unit cost</em>}</li>
 *   <li>{@link edu.cmu.cs.webapp.ioms.models.impl.IngredientImpl#getRemark <em>Remark</em>}</li>
 *   <li>{@link edu.cmu.cs.webapp.ioms.models.impl.IngredientImpl#getLastUpdate <em>Last Update</em>}</li>
 *   <li>{@link edu.cmu.cs.webapp.ioms.models.impl.IngredientImpl#getUpdateBy <em>Update By</em>}</li>
 *   <li>{@link edu.cmu.cs.webapp.ioms.models.impl.IngredientImpl#getDemand <em>Demand</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class IngredientImpl extends EObjectImpl implements Ingredient {
	/**
	 * The default value of the '{@link #getIng_id() <em>Ing id</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getIng_id()
	 * @generated
	 * @ordered
	 */
	protected static final int ING_ID_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getIng_id() <em>Ing id</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getIng_id()
	 * @generated
	 * @ordered
	 */
	protected int ing_id = ING_ID_EDEFAULT;

	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getInventory() <em>Inventory</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getInventory()
	 * @generated
	 * @ordered
	 */
	protected static final double INVENTORY_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getInventory() <em>Inventory</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getInventory()
	 * @generated
	 * @ordered
	 */
	protected double inventory = INVENTORY_EDEFAULT;

	/**
	 * The default value of the '{@link #getUnit_cost() <em>Unit cost</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getUnit_cost()
	 * @generated
	 * @ordered
	 */
	protected static final double UNIT_COST_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getUnit_cost() <em>Unit cost</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getUnit_cost()
	 * @generated
	 * @ordered
	 */
	protected double unit_cost = UNIT_COST_EDEFAULT;

	/**
	 * The default value of the '{@link #getRemark() <em>Remark</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getRemark()
	 * @generated
	 * @ordered
	 */
	protected static final String REMARK_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getRemark() <em>Remark</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getRemark()
	 * @generated
	 * @ordered
	 */
	protected String remark = REMARK_EDEFAULT;

	/**
	 * The default value of the '{@link #getLastUpdate() <em>Last Update</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getLastUpdate()
	 * @generated
	 * @ordered
	 */
	protected static final Date LAST_UPDATE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getLastUpdate() <em>Last Update</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getLastUpdate()
	 * @generated
	 * @ordered
	 */
	protected Date lastUpdate = LAST_UPDATE_EDEFAULT;

	/**
	 * The default value of the '{@link #getUpdateBy() <em>Update By</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getUpdateBy()
	 * @generated
	 * @ordered
	 */
	protected static final String UPDATE_BY_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getUpdateBy() <em>Update By</em>}' attribute.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @see #getUpdateBy()
	 * @generated
	 * @ordered
	 */
	protected String updateBy = UPDATE_BY_EDEFAULT;

	/**
	 * The default value of the '{@link #getDemand() <em>Demand</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDemand()
	 * @generated
	 * @ordered
	 */
	protected static final double DEMAND_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getDemand() <em>Demand</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDemand()
	 * @generated
	 * @ordered
	 */
	protected double demand = DEMAND_EDEFAULT;

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	protected IngredientImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return IOMSPackage.Literals.INGREDIENT;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public int getIng_id() {
		return ing_id;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIng_id(int newIng_id) {
		int oldIng_id = ing_id;
		ing_id = newIng_id;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMSPackage.INGREDIENT__ING_ID, oldIng_id, ing_id));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMSPackage.INGREDIENT__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public double getInventory() {
		return inventory;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public void setInventory(double newInventory) {
		double oldInventory = inventory;
		inventory = newInventory;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMSPackage.INGREDIENT__INVENTORY, oldInventory, inventory));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public double getUnit_cost() {
		return unit_cost;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public void setUnit_cost(double newUnit_cost) {
		double oldUnit_cost = unit_cost;
		unit_cost = newUnit_cost;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMSPackage.INGREDIENT__UNIT_COST, oldUnit_cost, unit_cost));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public String getRemark() {
		return remark;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public void setRemark(String newRemark) {
		String oldRemark = remark;
		remark = newRemark;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMSPackage.INGREDIENT__REMARK, oldRemark, remark));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public Date getLastUpdate() {
		return lastUpdate;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public void setLastUpdate(Date newLastUpdate) {
		Date oldLastUpdate = lastUpdate;
		lastUpdate = newLastUpdate;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMSPackage.INGREDIENT__LAST_UPDATE, oldLastUpdate, lastUpdate));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public String getUpdateBy() {
		return updateBy;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	public void setUpdateBy(String newUpdateBy) {
		String oldUpdateBy = updateBy;
		updateBy = newUpdateBy;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMSPackage.INGREDIENT__UPDATE_BY, oldUpdateBy, updateBy));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getDemand() {
		return demand;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDemand(double newDemand) {
		double oldDemand = demand;
		demand = newDemand;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, IOMSPackage.INGREDIENT__DEMAND, oldDemand, demand));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case IOMSPackage.INGREDIENT__ING_ID:
				return getIng_id();
			case IOMSPackage.INGREDIENT__NAME:
				return getName();
			case IOMSPackage.INGREDIENT__INVENTORY:
				return getInventory();
			case IOMSPackage.INGREDIENT__UNIT_COST:
				return getUnit_cost();
			case IOMSPackage.INGREDIENT__REMARK:
				return getRemark();
			case IOMSPackage.INGREDIENT__LAST_UPDATE:
				return getLastUpdate();
			case IOMSPackage.INGREDIENT__UPDATE_BY:
				return getUpdateBy();
			case IOMSPackage.INGREDIENT__DEMAND:
				return getDemand();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case IOMSPackage.INGREDIENT__ING_ID:
				setIng_id((Integer)newValue);
				return;
			case IOMSPackage.INGREDIENT__NAME:
				setName((String)newValue);
				return;
			case IOMSPackage.INGREDIENT__INVENTORY:
				setInventory((Double)newValue);
				return;
			case IOMSPackage.INGREDIENT__UNIT_COST:
				setUnit_cost((Double)newValue);
				return;
			case IOMSPackage.INGREDIENT__REMARK:
				setRemark((String)newValue);
				return;
			case IOMSPackage.INGREDIENT__LAST_UPDATE:
				setLastUpdate((Date)newValue);
				return;
			case IOMSPackage.INGREDIENT__UPDATE_BY:
				setUpdateBy((String)newValue);
				return;
			case IOMSPackage.INGREDIENT__DEMAND:
				setDemand((Double)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case IOMSPackage.INGREDIENT__ING_ID:
				setIng_id(ING_ID_EDEFAULT);
				return;
			case IOMSPackage.INGREDIENT__NAME:
				setName(NAME_EDEFAULT);
				return;
			case IOMSPackage.INGREDIENT__INVENTORY:
				setInventory(INVENTORY_EDEFAULT);
				return;
			case IOMSPackage.INGREDIENT__UNIT_COST:
				setUnit_cost(UNIT_COST_EDEFAULT);
				return;
			case IOMSPackage.INGREDIENT__REMARK:
				setRemark(REMARK_EDEFAULT);
				return;
			case IOMSPackage.INGREDIENT__LAST_UPDATE:
				setLastUpdate(LAST_UPDATE_EDEFAULT);
				return;
			case IOMSPackage.INGREDIENT__UPDATE_BY:
				setUpdateBy(UPDATE_BY_EDEFAULT);
				return;
			case IOMSPackage.INGREDIENT__DEMAND:
				setDemand(DEMAND_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case IOMSPackage.INGREDIENT__ING_ID:
				return ing_id != ING_ID_EDEFAULT;
			case IOMSPackage.INGREDIENT__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case IOMSPackage.INGREDIENT__INVENTORY:
				return inventory != INVENTORY_EDEFAULT;
			case IOMSPackage.INGREDIENT__UNIT_COST:
				return unit_cost != UNIT_COST_EDEFAULT;
			case IOMSPackage.INGREDIENT__REMARK:
				return REMARK_EDEFAULT == null ? remark != null : !REMARK_EDEFAULT.equals(remark);
			case IOMSPackage.INGREDIENT__LAST_UPDATE:
				return LAST_UPDATE_EDEFAULT == null ? lastUpdate != null : !LAST_UPDATE_EDEFAULT.equals(lastUpdate);
			case IOMSPackage.INGREDIENT__UPDATE_BY:
				return UPDATE_BY_EDEFAULT == null ? updateBy != null : !UPDATE_BY_EDEFAULT.equals(updateBy);
			case IOMSPackage.INGREDIENT__DEMAND:
				return demand != DEMAND_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (ing_id: ");
		result.append(ing_id);
		result.append(", name: ");
		result.append(name);
		result.append(", inventory: ");
		result.append(inventory);
		result.append(", unit_cost: ");
		result.append(unit_cost);
		result.append(", remark: ");
		result.append(remark);
		result.append(", lastUpdate: ");
		result.append(lastUpdate);
		result.append(", updateBy: ");
		result.append(updateBy);
		result.append(", demand: ");
		result.append(demand);
		result.append(')');
		return result.toString();
	}

} // IngredientImpl
